Skip to content

Comments

lint: dead code cleanup + redundant expression fixes#647

Merged
datdamnzotz merged 7 commits intoOrcpub:developfrom
codeGlaze:fix/lint-dead-code
Feb 20, 2026
Merged

lint: dead code cleanup + redundant expression fixes#647
datdamnzotz merged 7 commits intoOrcpub:developfrom
codeGlaze:fix/lint-dead-code

Conversation

@codeGlaze
Copy link

Lint maintenance part 2!

Summary

  • Add .clj-kondo/config.edn with LSP suppression rules for re-frame
    registrations and 5 live false-positives; fix deprecated :if linter
    name → :missing-else-branch
  • Reader-discard (#_) ~92 dead vars across 10 source files (shared
    .cljc and frontend .cljs), each annotated with reason
    (dead/deprecated/superseded)
  • Fix redundant expressions: nested (str (str ...)) → bare strings,
    (and (and ...)) → flattened, duplicate destructuring param removal

Details

Config (.clj-kondo/config.edn):

  • :exclude-when-defined-by for reg-event-db, reg-event-fx,
    reg-sub, reg-sub-raw (re-frame keyword dispatch is invisible to LSP)
  • :exclude for 5 live vars that trigger false-positive unused warnings
  • Renamed deprecated :if linter → :missing-else-branch {:level :off}

Dead code (11 files, 235 insertions / 126 deletions):

  • common.cljc: 4 unused time-conversion helpers
  • character.cljc: 6 dead vars (namespace helpers, speed, AC)
  • classes.cljc: 4 dead vars + redundant str
  • options.cljc: 15 dead vars + flatten nested and + remove duplicate param
  • template.cljc: 14 dead vars (ability roller UI, amazon frames, point-buy)
  • views.cljs: 25 dead vars + redundant str fixes
  • events.cljs: 22 dead event handlers + remove unused tab-path refer
  • db.cljs, subs.cljs, character_builder.cljs: 1-4 dead vars/fixes each

All #_ discards include a comment explaining why.
Verified: 0 lint errors, 0 lint warnings, 102 JVM tests pass, CLJS compiles clean.

Test plan

  • lein test — 102 tests pass
  • lein cljsbuild once dev — CLJS compiles with 0 errors
  • lein with-profile lint run -m clj-kondo.main --lint src — 0 errors, 0 warnings

- Rename :if to :missing-else-branch (correct clj-kondo linter name)
- Add :clojure-lsp/unused-public-var :exclude for 5 live vars that LSP
  can't trace (cross-file macro refs, test-only callers)
- Add :exclude-when-defined-by for re-frame reg-event-db, reg-event-fx,
  reg-sub, reg-sub-raw (keyword dispatch is invisible to LSP)
#_ discard 43 dead vars:
- common.cljc (4): ptime, hours-per-day, rounds-to-hours, rounds-to-minutes
- character.cljc (6): add-namespaces + 2 cascade helpers, base-climbing-speed,
  saving-throw-advantages, max-armor-class
- classes.cljc (4): blessings-of-knowledge-skill, spell-level-to-cleric-level,
  spell-in-spells-known?, pact-weapon-option
- options.cljc (15): deprecated ua/scag refs (skill-or-expertise-selection,
  subclass-plugin, subclass-cantrip-selection, druid-cantrip-selection,
  eldritch-invocation-option, deep-gnome-option-cfg, subrace-prereq),
  #_ template refs (add-sources, artisans-tools-choice-cfg), zero-caller
  defs (levels, key-to-name, any-language-selection, charge-summary,
  defensive-duelist-summary, ability-modifiers, subclass-level-option)
- template.cljc (14): ability roller UI (6 fns + score-costs + point-buy-points),
  amazon frames (3), content-list, custom-race-builder;
  #_ subscribe/dispatch refers (no live callers remain)

Redundant expression fixes:
- classes.cljc: remove nested (str (str ...))
- options.cljc: flatten (and (and ...)) in dual-wield checks,
  remove duplicate source destructuring param
#_ discard 49 dead vars:
- views.cljs (25): style defs (header-tab-style, desktop-menu-item-style,
  search-icon-style, transparent-search-input-style, row-style, light-row-style,
  list-style, thumbnail-style, summary-style, option-pack-styles, invalid-styling),
  duplicate constants (rounds-per-minute, minutes-per-hour, hours-per-day),
  superseded components (srd-link, realize-char, svg-icon-section, compare-spell,
  equipment-section, default-image, select-builder-field, text-field,
  subrace-damage-resistance, selection-selector, no-https-images)
- events.cljs (22): dead defs (max-iterations, dnd-5e-characters-path,
  validate-registration, set-active-tabs, remove-subtypes), 17 never-dispatched
  reg-event-db/fx handlers (toggle-public, load-characters, hide-warning,
  open-orcacle, set-builder-item, set-spell-list, set-feature-prop,
  toggle-feat-selection, toggle-*-value-prop, toggle-*-map-prop, etc.);
  remove unused tab-path refer
- db.cljs (1): musical-instrument-choice-cfg (duplicate of classes.cljc)
- subs.cljs (1): ::char5e/summary reg-sub (never subscribed to)

Redundant expression fixes:
- views.cljs: remove (str ...) wrapping bare strings
- character_builder.cljs: remove (str "CLICK HERE...") on 4 string literals
- events.cljs: remove (str "all-content.orcbrew") on 2 string literals
Merge the top-level :clojure-lsp/unused-public-var into the :linters
section where clj-kondo actually reads it. Add missing settings from
the lint-missing-else branch: :output exclude-files, garden.selectors
unresolved-var, read-string exclude, folder-test/with-conn lint-as,
and :missing-else-branch :warning.
Removed broken with-conn lint-as, added orcpub.errors unresolved-var
exclude, added spell_subs cross-file refs to unused-public-var exclude.
The def was incorrectly marked as dead code, but the legal footer
in main-page still references it. Remove the #_ reader discard and
the stale "dead" comment.
@datdamnzotz datdamnzotz self-requested a review February 20, 2026 14:57
@datdamnzotz datdamnzotz added enhancement New feature or request area/application Task related to orcpub application itself labels Feb 20, 2026
@github-project-automation github-project-automation bot moved this to In progress in Orcpub Feb 20, 2026
@datdamnzotz datdamnzotz added this to the 2.5.0.29 milestone Feb 20, 2026
@datdamnzotz datdamnzotz merged commit e775c5a into Orcpub:develop Feb 20, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Orcpub Feb 20, 2026
@codeGlaze codeGlaze deleted the fix/lint-dead-code branch February 24, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/application Task related to orcpub application itself enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants